<%@ Page Title="Employee Search" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="_EmployeeSearch.aspx.cs" Inherits="AdventureWorks.Client.Web.EmployeeSearch" %>

<%@ Import Namespace="AdventureWorks.Client.Objects" %>
<%@ Register src="~/Errors.ascx" tagname="Errors" tagprefix="asp" %>
<%@ Register tagprefix="asp" Namespace="System.Web.UI.WebControls" %>
<asp:Content xmlns:asp="clr-namespace:System.Web.UI.WebControls" ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
   <h2>Employee Search</h2>
   <asp:Panel runat="server" ID="pnlCriteria" GroupingText="Search Criteria">
      <table style="width: 100%;">
         <tr>
            <td class="fieldColumn">
               <div class="field">
                  <asp:Label runat="server" ID="lblFirstName" CssClass="label" Text="First Name:"></asp:Label>
                  <asp:DropDownList LabelID="lblFirstName" ID="ctlFirstNameOperator" Property="<%# EmployeeCriteria.FirstNameOperator %>" runat="server" AutoPostBack="true" CssClass="operator"></asp:DropDownList>
                  <asp:TextBox ID="ctlFirstName" Property="<%# EmployeeCriteria.FirstName %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblLastName" CssClass="label" Text="Last Name:"></asp:Label>
                  <asp:TextBox LabelID="lblLastName" ID="ctlLastName" Property="<%# EmployeeCriteria.LastName %>" runat="server"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblManagerLastName" CssClass="label" Text="Manager Last Name:"></asp:Label>
                  <asp:TextBox LabelID="lblManagerLastName" ID="ctlManagerLastName" Property="<%# EmployeeCriteria.ManagerLastName %>" runat="server"></asp:TextBox>
               </div>
            </td>
            <td class="fieldColumn">
               <div class="field">
                  <asp:Label runat="server" ID="lblHireDate" CssClass="label" Text="Hire Date:"></asp:Label>
                  <asp:DropDownList LabelID="lblHireDate" ID="ctlHireDateOperator" Property="<%# EmployeeCriteria.HireDateOperator %>" runat="server" AutoPostBack="true" CssClass="operator"></asp:DropDownList>
                  <asp:TextBox ID="ctlHireDate" Property="<%# EmployeeCriteria.HireDate %>" runat="server" CssClass="date"></asp:TextBox>
                  <asp:TextBox ID="ctlHireDate2" Property="<%# EmployeeCriteria.HireDate2 %>" runat="server" CssClass="date"></asp:TextBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblState" CssClass="label" Text="State:"></asp:Label>
                  <asp:DropDownList LabelID="lblState" ID="ctlStateOperator" Property="<%# EmployeeCriteria.StateOperator %>" runat="server" AutoPostBack="true" CssClass="operator"></asp:DropDownList>
                  <asp:ListBox ID="ctlState" Property="<%# EmployeeCriteria.State %>" runat="server"></asp:ListBox>
               </div>
               <div class="field">
                  <asp:Label runat="server" ID="lblZipcode" CssClass="label" Text="Zipcode:"></asp:Label>
                  <asp:DropDownList LabelID="lblZipcode" ID="ctlZipcodeOperator" Property="<%# EmployeeCriteria.ZipcodeOperator %>" runat="server" AutoPostBack="true" CssClass="operator"></asp:DropDownList>
                  <asp:TextBox ID="ctlZipcode" Property="<%# EmployeeCriteria.Zipcode %>" runat="server"></asp:TextBox>
               </div>
            </td>
         </tr>
      </table>
   </asp:Panel>
   <div>
      <asp:Errors ID="errors" runat="server"></asp:Errors>
   </div>
   <div>
      <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" CssClass="searchButton"></asp:Button>
      <asp:Button ID="btnReset" runat="server" Text="Reset" OnClick="btnReset_Click" CssClass="searchButton"></asp:Button>
   </div>
   <asp:Panel ID="pnlResults" runat="server">
      <asp:GridView runat="server" ID="grdResults">
         <Columns>
            <asp:TemplateField HeaderText="Id">
               <ItemTemplate>
                  <asp:HyperLink runat="server" NavigateUrl="~/_EmployeeDetails.aspx?EmployeeId={value}" ID="fldId" Property="<%# EmployeeRowObject.Id %>"></asp:HyperLink>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="First Name">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldFirstName" Property="<%# EmployeeRowObject.FirstName %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Last Name">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldLastName" Property="<%# EmployeeRowObject.LastName %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Title">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldTitle" Property="<%# EmployeeRowObject.Title %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Hire Date">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldHireDate" Property="<%# EmployeeRowObject.HireDate %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Manager">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldManager" Property="<%# EmployeeRowObject.Manager %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Salaried">
               <ItemTemplate>
                  <asp:CheckBox runat="server" ID="fldSalaried" Property="<%# EmployeeRowObject.Salaried %>"></asp:CheckBox>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Current">
               <ItemTemplate>
                  <asp:CheckBox runat="server" ID="fldCurrent" Property="<%# EmployeeRowObject.Current %>"></asp:CheckBox>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Gender">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldGender" Property="<%# EmployeeRowObject.Gender %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="State Id">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldStateId" Property="<%# EmployeeRowObject.StateId %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Street Address">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldStreetAddress" Property="<%# AddressObject.StreetAddress %>" ChildObject="<%# EmployeeRowObject.Address %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="City">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldCity" Property="<%# AddressObject.City %>" ChildObject="<%# EmployeeRowObject.Address %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="State">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldState" Property="<%# AddressObject.State %>" ChildObject="<%# EmployeeRowObject.Address %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Zipcode">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldZipcode" Property="<%# AddressObject.Zipcode %>" ChildObject="<%# EmployeeRowObject.Address %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
            <asp:TemplateField HeaderText="Country">
               <ItemTemplate>
                  <asp:Label runat="server" ID="fldCountry" Property="<%# AddressObject.Country %>" ChildObject="<%# EmployeeRowObject.Address %>"></asp:Label>
               </ItemTemplate>
            </asp:TemplateField>
         </Columns>
      </asp:GridView>
      <asp:HyperLink runat="server" ID="lnkCreateNew" Text="Create New..." NavigateUrl="~/Gen/_EmployeeObjectPage.aspx"></asp:HyperLink>
   </asp:Panel>
</asp:Content>